﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_WebControls_GetNewestProduct : System.Web.UI.UserControl
{
    private int _NumberOfProducts = 1;
    private StoreApplicationService sas = new StoreApplicationService();

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            var newestproducts = sas.GetNewestProducts(_NumberOfProducts);

            RepeaterItemsList.DataSource = newestproducts;
            RepeaterItemsList.DataBind();
        }
        catch (Exception exp)
        {
            throw new Exception("ERROR:Control: Unable to newest products - " + exp.Message.ToString(), exp);
        }
    }

    public int NumberOFProducts
    {
        get { return _NumberOfProducts; }
        set { _NumberOfProducts = value; }
    }

}